package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.AdvertLaunch;
import com.micro.modual.model.bo.advertlaunch.AdvertLaunchBO;

/**
 * <h1>广告基础表 延展类</h1>
 *
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:27
 */
public class AdvertLaunchExtension {

    /**
     * <h2>转换: 广告基础表 新增</h2>
     *
     * @param advertLaunchBO {@link AdvertLaunchBO} 广告基础表 新增/修改 请求对象
     * @return {@link AdvertLaunch} 广告基础表
     */
    public static AdvertLaunch converAddAdvertLaunch(AdvertLaunchBO advertLaunchBO) {
        AdvertLaunch advertLaunch = new AdvertLaunch();
        advertLaunch.setId(SnowFlakeUtil.getId());
        advertLaunch.setAdvertCode(GeneratorCodeUtil.generatorSystemCode());
        advertLaunch.setAdvertName(advertLaunchBO.getAdvertName());
        advertLaunch.setAdvertStatus(advertLaunchBO.getAdvertStatus());
        advertLaunch.setAdvertLaunchType(advertLaunchBO.getAdvertLaunchType());
        advertLaunch.setAdvertLaunchPosition(advertLaunchBO.getAdvertLaunchPosition());
        advertLaunch.setAdvertUrl(advertLaunchBO.getAdvertUrl());
        advertLaunch.setAdvertImage(advertLaunchBO.getAdvertImage());
        advertLaunch.setAdvertType(MicroConstant.StatusExecution.NOT_STARTED);
        advertLaunch.setAdvertLaunchStartTime(advertLaunchBO.getAdvertLaunchStartTime());
        advertLaunch.setAdvertLanuchEndTime(advertLaunchBO.getAdvertLanuchEndTime());
        advertLaunch.setAdvertAttributionType((byte)2);
        advertLaunch.setAdvertAttributionLogo(MicroConstant.SystemDefaultValue.DEFAULT_SYSTEM_CODE);
        advertLaunch.setAdvertDesc(advertLaunchBO.getAdvertDesc());
        return advertLaunch;
    }


    /**
     * <h2>转换: 广告基础表 修改</h2>
     *
     * @param advertLaunchBO {@link AdvertLaunchBO} 广告基础表 新增/修改 请求对象
     * @return {@link AdvertLaunch} 广告基础表
     */
    public static AdvertLaunch converEditAdvertLaunch(AdvertLaunchBO advertLaunchBO) {
        AdvertLaunch advertLaunch = new AdvertLaunch();
        advertLaunch.setId(advertLaunchBO.getId());
        advertLaunch.setAdvertCode(GeneratorCodeUtil.generatorSystemCode());
        advertLaunch.setAdvertDesc(advertLaunchBO.getAdvertDesc());
        advertLaunch.setAdvertImage(advertLaunchBO.getAdvertImage());
        advertLaunch.setAdvertLanuchEndTime(advertLaunchBO.getAdvertLanuchEndTime());
        advertLaunch.setAdvertLaunchPosition(advertLaunchBO.getAdvertLaunchPosition());
        advertLaunch.setAdvertLaunchStartTime(advertLaunchBO.getAdvertLaunchStartTime());
        advertLaunch.setAdvertLaunchType(advertLaunchBO.getAdvertLaunchType());
        advertLaunch.setAdvertLaunchStartTime(advertLaunchBO.getAdvertLaunchStartTime());
        advertLaunch.setAdvertUrl(advertLaunchBO.getAdvertUrl());
        advertLaunch.setAdvertType(advertLaunchBO.getAdvertType());
        advertLaunch.setAdvertName(advertLaunchBO.getAdvertName());
        return advertLaunch;
    }
}
